home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Produtividade / Software2 / Product4 / Setup.exe / drupal-4.6.0 / modules / story.module < prev    next >
Encoding:
Text File  |  2005-04-01  |  1.8 KB  |  83 lines

  1. <?php
  2. // $Id: story.module,v 1.167 2005/04/01 15:55:01 dries Exp $
  3.  
  4. /**
  5.  * @file
  6.  * Enables users to submit stories, articles or similar content.
  7.  */
  8.  
  9. /**
  10.  * Implementation of hook_help().
  11.  */
  12. function story_help($section) {
  13.   switch ($section) {
  14.     case 'admin/modules#description':
  15.       return t('Allows users to submit stories, articles or similar content.');
  16.     case 'node/add#story':
  17.       return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.');
  18.   }
  19. }
  20.  
  21. /**
  22.  * Implementation of hook_node_name().
  23.  */
  24. function story_node_name($node) {
  25.   return t('story');
  26. }
  27.  
  28. /**
  29.  * Implementation of hook_perm().
  30.  */
  31. function story_perm() {
  32.   return array('create stories', 'edit own stories');
  33. }
  34.  
  35. /**
  36.  * Implementation of hook_access().
  37.  */
  38. function story_access($op, $node) {
  39.   global $user;
  40.  
  41.   if ($op == 'create') {
  42.     return user_access('create stories');
  43.   }
  44.  
  45.   if ($op == 'update' || $op == 'delete') {
  46.     if (user_access('edit own stories') && ($user->uid == $node->uid)) {
  47.       return TRUE;
  48.     }
  49.   }
  50. }
  51.  
  52. /**
  53.  * Implementation of hook_menu().
  54.  */
  55. function story_menu($may_cache) {
  56.   $items = array();
  57.  
  58.   if ($may_cache) {
  59.     $items[] = array('path' => 'node/add/story', 'title' => t('story'),
  60.       'access' => user_access('create stories'));
  61.   }
  62.  
  63.   return $items;
  64. }
  65.  
  66. /**
  67.  * Implementation of hook_form().
  68.  */
  69. function story_form(&$node) {
  70.   $output = '';
  71.  
  72.   if (function_exists('taxonomy_node_form')) {
  73.     $output .= implode('', taxonomy_node_form('story', $node));
  74.   }
  75.  
  76.   $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
  77.   $output .= filter_form('format', $node->format);
  78.  
  79.   return $output;
  80. }
  81.  
  82. ?>
  83.